/**
 * Created with IntelliJ IDEA.
 * Description:
 */
public class Demo1 {
    public static void main(String[] args) {
        Thread thread1 =new Thread("t1"){
            @Override
            public void run() {
                while (true){
                    System.out.println("t1线程");
                    try {
                        Thread.sleep(1000);
                    } catch (InterruptedException e) {
                        throw new RuntimeException(e);
                    }
                }
            }
        };

        Thread thread2 =new Thread(()->{
            while (true){
                System.out.println("t2线程");
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    throw new RuntimeException(e);
                }
            }
        },"t2");
        thread1.start();
        thread2.start();

    }
}
